//创建分类列表仓库
import { defineStore } from "pinia";
import { ref } from "vue";
//引入API
import { getCategory } from "@/apis/layout";
//应用并导出仓库
export const useCategoryStore = defineStore(
  "category",
  () => {
    //导航列表的数据管理
    let categoryList = ref([]);
    //获取导航列表异步函数
    const getCategoryList = async () => {
      let res = await getCategory();
      categoryList.value = res.result;
    };
    return {
      categoryList,
      getCategoryList,
    };
  }
  // {
  //   persist: true,//数据持久化配置
  // }
);
